package com.mdp.workflow.biz.ru.service;

import com.mdp.core.api.CacheHKVService;
import com.mdp.workflow.biz.ru.entity.ProcinstNodeInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.concurrent.TimeUnit;
 

@Service
public class ProcinstNodeInfoCacheService {
	
	@Autowired
	CacheHKVService cacheHKVService;
	
	
	String cachKey="wf_ru_procinst_node_info_";
	
	public void putNodeInfos(String procInstId,List<ProcinstNodeInfo> nodeInfos) {
		cacheHKVService.put(cachKey+procInstId, procInstId, nodeInfos);
		cacheHKVService.expire(cachKey+procInstId, 100, TimeUnit.DAYS);
	}
	
	public List<ProcinstNodeInfo>   getNodeInfos(String procInstId) {
		return (List<ProcinstNodeInfo>) cacheHKVService.get(cachKey+procInstId, procInstId);
	}

	
}
